//
//  JSMLeavingMoreDetailsTableViewCell.m
//  TakeYouTourTogether
//
//  Created by dllo on 15/12/3.
//  Copyright © 2015年 king. All rights reserved.
//

#import "JSMLeavingMoreDetailsTableViewCell.h"

@implementation JSMLeavingMoreDetailsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.mainImageView = [[BaseImageView alloc] init];
    [self.contentView addSubview:self.mainImageView];
    
    self.mainLabel = [[BaseLabel alloc] init];
    [self.contentView addSubview:self.mainLabel];
    self.mainLabel.numberOfLines = 0;
    [self.mainLabel sizeToFit];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.mainImageView.frame = CGRectMake(15, 10, TableViewCellWidth - 30, (TableViewCellWidth - 30) * 2 / 3);
    
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16], NSFontAttributeName, nil];
    CGRect wordRect = [self.mainLabel.text boundingRectWithSize:CGSizeMake(TableViewCellWidth - 30, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    
    self.mainLabel.frame = CGRectMake(15, 15 + self.mainImageView.frame.size.height, TableViewCellWidth - 30, wordRect.size.height);

}

@end
